/* 通过id获取dom */
function getById(id) {
    return document.querySelector(id)
}

/* 通过类名获取dom */
function getByClass(className) {
    return document.querySelectorAll(className)
}

/* dom加载完毕 */
function ready(callback) {
    //onload  表示让页面所有资源(img html css ...)加载完成   才可以执行js代码
    //DOMContentLoaded 只要DOM(html)加载完成   才可以执行js代码
    window.addEventListener('DOMContentLoaded', function () {
        callback()
    })
}

<<<<<<< HEAD
<<<<<<< HEAD
function click(nav){
    getById("#Bbox").innerHTML=`
    <div class="${nav=='home'?'active':''}">
=======
function click(nav) {
    getById("#Bbox").innerHTML = `
    <div class="${nav == 'home' ? 'active' : ''}">
>>>>>>> wl
=======
function click(nav) {
    getById("#Bbox").innerHTML = `
    <div class="${nav == 'home' ? 'active' : ''}">
>>>>>>> wl
    <a href="home.html">
        <div class="iconfont icon-shouye ">
            <div>首页</div>
    </a>
    </div>
</div>
<<<<<<< HEAD
<<<<<<< HEAD
<div class="${nav=='sports'?'active':''}">
=======
<div class="${nav == 'sports' ? 'active' : ''}">
>>>>>>> wl
=======
<div class="${nav == 'sports' ? 'active' : ''}">
>>>>>>> wl
    <a href="sports.html">
        <div class="iconfont icon-diqiu">
            <div>运动</div>
    </a>
    </div>
</div>
<<<<<<< HEAD
<<<<<<< HEAD
<div class="${nav=='quanzi'?'active':''}">
=======
<div class="${nav == 'quanzi' ? 'active' : ''}">
>>>>>>> wl
=======
<div class="${nav == 'quanzi' ? 'active' : ''}">
>>>>>>> wl
    <a href="quanzi.html">
        <div class="iconfont icon-shouye">
            <div>圈子</div>
    </a>
    </div>
</div>
<<<<<<< HEAD
<<<<<<< HEAD
<div class="${nav=='mine'?'active':''}">
=======
<div class="${nav == 'mine' ? 'active' : ''}">
>>>>>>> wl
=======
<div class="${nav == 'mine' ? 'active' : ''}">
>>>>>>> wl
    <a href="mine.html">
        <div class="iconfont icon-shouye">
            <div>我的</div>
    </a>
    </div>
</div>
    `
}

<<<<<<< HEAD
<<<<<<< HEAD

=======
=======
>>>>>>> wl
function dbclick(sun) {
    getById('#head').innerHTML = `
 <div class="${sun == 'sports' ? 'colors' : ''}" ><a   href="sports.html">
     <div>跑步</div>
</a>
 </div>
 <div class="${sun == 'qixing' ? 'colors' : ''}" ><a   href="qixing.html">
 <div>骑行</div>
</a></div>
 <div  class="${sun == 'runing' ? ' colors' : ''}" ><a href="xunlian.html">
 <div>课程训练</div>
</a></div> 
 `
}
<<<<<<< HEAD
>>>>>>> wl
=======
>>>>>>> wl


// 暴露
module.exports = {
    getById,
    getByClass,
    ready,
<<<<<<< HEAD
<<<<<<< HEAD
    click
=======
    click,
    dbclick
>>>>>>> wl
=======
    click,
    dbclick
>>>>>>> wl
}